import Vue from 'vue'
import Router from 'vue-router'
// 导入刚才编写的组件

// import Login from '@/components/Login'
// import AppIndex from '@/components/home/AppIndex'
import Login from "../components/Login";
import AppIndex from "../components/hom/AppIndex";
import Home  from "../components/Home";
Vue.use(Router)

export default new Router({
  mode: 'history',        //路由history模式、地址去#
  routes: [
    {
      path:'/home',
      name: 'Home',
      component:Home,

      redirect:'/index',
      children:[
    {
      path: '/index',
      name: 'AppIndex',
      component: AppIndex,
      meta: {
        requireAuth: true   //为了区分页面是否需要拦截在需要拦截的路由中加一条元数据，设置一个 requireAuth 字段
      }
    }
    ]
},
    // 下面都是固定的写法
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
   ]
})
